package com.itedge.solutionmanager.service.domain.impl;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Service;

import com.itedge.infrastructure.service.domain.impl.AbstractJpaEntityService;
import com.itedge.solutionmanager.domain.impl.ContactPerson;
import com.itedge.solutionmanager.service.domain.IContactPersonService;

@Service
public class ContactPersonService extends AbstractJpaEntityService<ContactPerson>
	implements IContactPersonService {

	@PersistenceContext
    transient EntityManager entityManager; 
	
	@Override
	protected EntityManager getEntityManager() {
		return this.entityManager;
	}

	@Override
	protected Class<ContactPerson> getClassReference() {
		return ContactPerson.class;
	}	
	
	@Override
	public ContactPerson getContactPersonReference(Long id) {
		if(id == null) return null;
		return this.entityManager.getReference(ContactPerson.class, id);
	}
	
}